﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace YArchitech.HCLoad.XmlData
{
	public class RoomResult : Result
	{
		public RoomLoadResult ResultOfRoof
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Roof];
			}
		}

		public RoomLoadResult ResultOfSkyLight
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_SkyLight];
			}
		}

		public RoomLoadResult ResultOfOutWall
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_OutWall];
			}
		}

		public RoomLoadResult ResultOfOutWindow
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_OutWindow];
			}
		}

		public RoomLoadResult ResultOfInWall
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_InWall];
			}
		}

		public RoomLoadResult ResultOfInWindow
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_InWindow];
			}
		}

		public RoomLoadResult ResultOfStringboard
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Stringboard];
			}
		}

		public RoomLoadResult ResultOfOutDoor
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_OutDoor];
			}
		}

		public RoomLoadResult ResultOfInDoor
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_InDoor];
			}
		}

		public RoomLoadResult ResultOfGround
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Ground];
			}
		}

		public RoomLoadResult ResultOfAerialBoard
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_AerialBoard];
			}
		}

		public RoomLoadResult ResultOfFlyWindow
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_FlyWindow];
			}
		}

		public RoomLoadResult ResultOfArcWall
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_ArcWall];
			}
		}

		public RoomLoadResult ResultOfFreshAir
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_FreshAir];
			}
		}

		public RoomLoadResult ResultOfPeople
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Body];
			}
		}

		public RoomLoadResult ResultOfLighting
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Lighting];
			}
		}

		public RoomLoadResult ResultOfEquipment
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Equipment];
			}
		}

		public RoomLoadResult ResultOfFood
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Food];
			}
		}

		public RoomLoadResult ResultOfChemistry
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Chemistry];
			}
		}

		public RoomLoadResult ResultOfWater
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Water];
			}
		}

		public RoomLoadResult ResultOfFlowWater
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_FlowWater];
			}
		}

		public RoomLoadResult ResultOfFilter
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Filter];
			}
		}

		public RoomLoadResult ResultOfOther
		{
			get
			{
				return this.m_dicResults[HcObjectType.LO_Other];
			}
		}

		public Result ResultOfExteriorSurfaces
		{
			get
			{
				if (this.m_ResultOfExteriorSurfaces == null)
				{
					this.m_ResultOfExteriorSurfaces = new Result();
					this.m_ResultOfExteriorSurfaces.Increase(this.ResultOfOutWall);
					this.m_ResultOfExteriorSurfaces.Increase(this.ResultOfOutWindow);
					this.m_ResultOfExteriorSurfaces.Increase(this.ResultOfOutDoor);
					this.m_ResultOfExteriorSurfaces.Increase(this.ResultOfRoof);
					this.m_ResultOfExteriorSurfaces.Increase(this.ResultOfAerialBoard);
				}
				return this.m_ResultOfExteriorSurfaces;
			}
		}

		public Result ResultOfInteriorSurfaces
		{
			get
			{
				if (this.m_ResultOfInteriorSurfaces == null)
				{
					this.m_ResultOfInteriorSurfaces = new Result();
					this.m_ResultOfInteriorSurfaces.Increase(this.ResultOfInDoor);
					this.m_ResultOfInteriorSurfaces.Increase(this.ResultOfInWindow);
					this.m_ResultOfInteriorSurfaces.Increase(this.ResultOfInWall);
					this.m_ResultOfInteriorSurfaces.Increase(this.ResultOfStringboard);
					this.m_ResultOfInteriorSurfaces.Increase(this.ResultOfGround);
				}
				return this.m_ResultOfInteriorSurfaces;
			}
		}

		public Result ResultOfSurfaces
		{
			get
			{
				if (this.m_ResultOfSurfaces == null)
				{
					this.m_ResultOfSurfaces = new Result();
					this.m_ResultOfSurfaces.Increase(this.ResultOfExteriorSurfaces);
					this.m_ResultOfSurfaces.Increase(this.ResultOfInteriorSurfaces);
				}
				return this.m_ResultOfSurfaces;
			}
		}

		public Result ResultOfXFDealLoad
		{
			get
			{
				return this.m_ResultOfXFDealLoad;
			}
		}

		public Result ResultOfInDoorLoad
		{
			get
			{
				if (this.m_ResultOfInDoorLoad == null)
				{
					this.m_ResultOfInDoorLoad = new Result();
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfSurfaces);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfPeople);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfLighting);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfEquipment);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfFilter);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfFood);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfChemistry);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfWater);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfFlowWater);
					this.m_ResultOfInDoorLoad.Increase(this.ResultOfOther);
					this.m_ResultOfInDoorLoad.Decrease(this.ResultOfXFDealLoad);
				}
				return this.m_ResultOfInDoorLoad;
			}
		}

		public double CoolingFreshAir
		{
			get
			{
				return this.m_dXFVolum;
			}
		}

		public double HeatingFreshAir
		{
			get
			{
				return this.m_dDJXFVolum;
			}
		}

		public Room Room
		{
			get
			{
				return this.m_room;
			}
		}

		public RoomResult(Room room)
		{
			this.m_room = room;
			this.m_arrZLFHAll = Result.Sum(room.ZsLfhQr, room.ZsLfhXr);
			this.m_arrZLFhQr = room.ZsLfhQr;
			this.m_arrZLFhXr = room.ZsLfhXr;
			this.m_arrZSFh = room.ZsSfh;
			this.m_dDJRFHXr = room.DjRfhXr;
			this.m_dDJRFHQr = room.DjRfhQr;
			this.m_dDJSFH = room.DjSfh;
			this.m_nMaxTime = Result.GetMaxValueIndex(this.m_arrZLFHAll);
			this.InitLoaItemResult();
			this.GetLoadItemResult();
		}

		private bool InitLoaItemResult()
		{
			this.m_dicResults = new Dictionary<HcObjectType, RoomLoadResult>();
			foreach (object obj in Enum.GetValues(typeof(HcObjectType)))
			{
				HcObjectType key = (HcObjectType)obj;
				this.m_dicResults.Add(key, new RoomLoadResult());
			}
			this.m_stuDJHeatDetail = new ConsumedHeatingResult();
			this.m_stuDJKtLoad = new AirConditioningHeatingResult();
			this.m_ResultOfXFDealLoad = new Result();
			return true;
		}

		private bool GetLoadItemResult()
		{
			if (this.bGetLoadItems || this.m_dicResults == null || this.m_room.RoomLoadCollect == null)
			{
				return true;
			}
			IDictionaryEnumerator enumerator = this.m_room.RoomLoadCollect.GetEnumerator();
			enumerator.Reset();
			while (enumerator.MoveNext())
			{
				RoomLoad loadItem = enumerator.Value as RoomLoad;
				this.AddToResult(loadItem);
			}
			this.bGetLoadItems = true;
			return true;
		}

		private void AddToResult(RoomLoad loadItem)
		{
			if (HcObjectType.LO_FreshAir == loadItem.LoadType)
			{
				this.AppendToFreshAirResult(loadItem);
			}
			RoomLoadResult roomLoadResult = new RoomLoadResult(loadItem);
			this.m_dicResults[loadItem.LoadType].Increase(roomLoadResult);
			roomLoadResult.AppendToHeatLoad(ref this.m_stuDJHeatDetail);
			roomLoadResult.AppendToXFDealLoad(ref this.m_ResultOfXFDealLoad);
			if (this.m_room.IsKtRfh)
			{
				roomLoadResult.AppendToKTLoad(ref this.m_stuDJKtLoad);
			}
			if (loadItem.ChildCollect != null)
			{
				IDictionaryEnumerator enumerator = loadItem.ChildCollect.GetEnumerator();
				enumerator.Reset();
				while (enumerator.MoveNext())
				{
					ChildWhJg childWhJg = enumerator.Value as ChildWhJg;
					if (childWhJg != null)
					{
						this.AddToResult(childWhJg);
					}
				}
			}
		}

		private bool AppendToFreshAirResult(RoomLoad loadItem)
		{
			if (loadItem.IsCooling)
			{
				this.m_dXFVolum += loadItem.FreshAirG;
			}
			else
			{
				this.m_dDJXFVolum += loadItem.FreshAirG;
			}
			return true;
		}

		public double[] CoolingLoadofExteriorSurfaces
		{
			get
			{
				if (this.ResultOfExteriorSurfaces == null)
				{
					return new double[24];
				}
				return this.ResultOfExteriorSurfaces.CoolingLoad;
			}
		}

		public double[] CoolingLoadofInteriorSurfaces
		{
			get
			{
				if (this.ResultOfInteriorSurfaces == null)
				{
					return new double[24];
				}
				return this.ResultOfInteriorSurfaces.CoolingLoad;
			}
		}

		public double[] CoolingLoadofSurfaces
		{
			get
			{
				if (this.ResultOfSurfaces == null)
				{
					return new double[24];
				}
				return this.ResultOfSurfaces.CoolingLoad;
			}
		}

		public double[] IndoorCoolingLoad
		{
			get
			{
				if (this.ResultOfInDoorLoad == null)
				{
					return new double[24];
				}
				return this.ResultOfInDoorLoad.CoolingLoad;
			}
		}

		public double[] IndoorCoolingSensibleLoad
		{
			get
			{
				this.GetLoadItemResult();
				return this.ResultOfInDoorLoad.CoolingSensibleLoad;
			}
		}

		public double[] IndoorCoolingLatentLoad
		{
			get
			{
				return this.ResultOfInDoorLoad.CoolingLatentLoad;
			}
		}

		public double[] IndoorCoolingHumidityLoad
		{
			get
			{
				if (this.ResultOfInDoorLoad == null)
				{
					return new double[24];
				}
				return this.ResultOfInDoorLoad.CoolingHumidityLoad;
			}
		}

		public double[] CoolingVentilationLoad
		{
			get
			{
				if (this.ResultOfFreshAir == null)
				{
					return new double[24];
				}
				return this.ResultOfFreshAir.CoolingLoad;
			}
		}

		public double[] CoolingVentilationSensibleLoad
		{
			get
			{
				if (this.ResultOfFreshAir == null)
				{
					return new double[24];
				}
				return this.ResultOfFreshAir.CoolingLatentLoad;
			}
		}

		public double[] CoolingVentilationLatentLoad
		{
			get
			{
				if (this.ResultOfFreshAir == null)
				{
					return new double[24];
				}
				return this.ResultOfFreshAir.CoolingSensibleLoad;
			}
		}

		public double[] CoolingVentilationHumidityLoad
		{
			get
			{
				return this.ResultOfFreshAir.CoolingHumidityLoad;
			}
		}

		public double[] CoolingLoadofSpacebyVentilation
		{
			get
			{
				if (this.ResultOfXFDealLoad == null)
				{
					return new double[24];
				}
				return this.ResultOfXFDealLoad.CoolingLoad;
			}
		}

		public double[] CoolingSensibleLoadofSpacebyVentilation
		{
			get
			{
				if (this.ResultOfXFDealLoad == null)
				{
					return new double[24];
				}
				return this.ResultOfXFDealLoad.CoolingSensibleLoad;
			}
		}

		public double[] CoolingLatentLoadofSpacebyVentilation
		{
			get
			{
				if (this.ResultOfXFDealLoad == null)
				{
					return new double[24];
				}
				return this.ResultOfXFDealLoad.CoolingLatentLoad;
			}
		}

		public double[] CoolingHumidityLoadofSpacebyVentilation
		{
			get
			{
				if (this.ResultOfXFDealLoad == null)
				{
					return new double[24];
				}
				return this.ResultOfXFDealLoad.CoolingHumidityLoad;
			}
		}

		public double[] CoolingLoadofWall
		{
			get
			{
				if (this.aryCoolingLoadofWall == null)
				{
					this.aryCoolingLoadofWall = Result.Sum(this.ResultOfOutWall.CoolingLoad, this.ResultOfInWall.CoolingLoad);
				}
				return this.aryCoolingLoadofWall;
			}
		}

		public int PeakCoolingLoadHour
		{
			get
			{
				return base.MaxValueTime;
			}
		}

		public int PeakIndoorCoolingLoadHour
		{
			get
			{
				return Result.GetMaxValueIndex(this.ResultOfInDoorLoad.CoolingLoad);
			}
		}

		public double[] CoolingLoadDensity
		{
			get
			{
				if (this.aryCoolingLoadDensity == null)
				{
					this.aryCoolingLoadDensity = Result.Devide(base.CoolingLoad, this.m_room.RoomArea);
				}
				return this.aryCoolingLoadDensity;
			}
		}

		public double[] HumidityLoadDensity
		{
			get
			{
				if (this.aryHumidityLoadDensity == null)
				{
					this.aryHumidityLoadDensity = Result.Devide(base.CoolingHumidityLoad, this.m_room.RoomArea);
				}
				return this.aryHumidityLoadDensity;
			}
		}

		public double[] IndoorCoolingLoadDensity
		{
			get
			{
				if (this.aryIndoorCoolingLoadDensity == null)
				{
					this.aryIndoorCoolingLoadDensity = Result.Devide(this.ResultOfInDoorLoad.CoolingLoad, this.m_room.RoomArea);
				}
				return this.aryIndoorCoolingLoadDensity;
			}
		}

		public double[] IndoorHumidityLoadDensity
		{
			get
			{
				if (this.aryIndoorHumidityLoadDensity == null)
				{
					this.aryIndoorHumidityLoadDensity = Result.Devide(this.ResultOfInDoorLoad.CoolingHumidityLoad, this.m_room.RoomArea);
				}
				return this.aryIndoorHumidityLoadDensity;
			}
		}

		public double DesignCoolT
		{
			get
			{
				return this.Room.RoomParam.XjSnSjWd;
			}
		}

		public double CoolingRelativeHumidity
		{
			get
			{
				return this.Room.RoomParam.XjSnSjXdSd;
			}
		}

		public HeatingResult HeatingResult
		{
			get
			{
				return this.m_stuDJCnLoad;
			}
		}

		public AirConditioningHeatingResult AirConditioningHeatingResult
		{
			get
			{
				return this.m_stuDJKtLoad;
			}
		}

		public double HeatingAirConditioningLoad
		{
			get
			{
				if (!this.m_room.IsKtRfh || this.m_stuDJKtLoad == null)
				{
					return 0.0;
				}
				return this.m_stuDJKtLoad.HeatingLoad;
			}
		}

		public double HeatingAirConditioningSensibleLoad
		{
			get
			{
				if (!this.m_room.IsKtRfh || this.m_stuDJKtLoad == null)
				{
					return 0.0;
				}
				return this.m_stuDJKtLoad.HeatingSensibleLoad;
			}
		}

		public double HeatingAirConditioningLatentLoad
		{
			get
			{
				if (!this.m_room.IsKtRfh || this.m_stuDJKtLoad == null)
				{
					return 0.0;
				}
				return this.m_stuDJKtLoad.HeatingLatentLoad;
			}
		}

		public double HeatingAirConditioningHumidityLoad
		{
			get
			{
				if (!this.m_room.IsKtRfh || this.m_stuDJKtLoad == null)
				{
					return 0.0;
				}
				return this.m_stuDJKtLoad.HeatingHumidityLoad;
			}
		}

		public double IndoorHeatingLoad
		{
			get
			{
				if (!this.m_room.IsKtRfh || this.ResultOfInDoorLoad == null)
				{
					return 0.0;
				}
				return this.ResultOfInDoorLoad.HeatingLoad;
			}
		}

		public double IndoorHeatingSensibleLoad
		{
			get
			{
				if (!this.m_room.IsKtRfh || this.ResultOfInDoorLoad == null)
				{
					return 0.0;
				}
				return this.ResultOfInDoorLoad.HeatingSensibleLoad;
			}
		}

		public double IndoorHeatingLatentLoad
		{
			get
			{
				if (!this.m_room.IsKtRfh || this.ResultOfInDoorLoad == null)
				{
					return 0.0;
				}
				return this.ResultOfInDoorLoad.HeatingLatentLoad;
			}
		}

		public double IndoorHeatingHumidityLoad
		{
			get
			{
				if (!this.m_room.IsKtRfh || this.ResultOfInDoorLoad == null)
				{
					return 0.0;
				}
				return this.ResultOfInDoorLoad.HeatingHumidityLoad;
			}
		}

		public double HeatingVentilationLoad
		{
			get
			{
				if (this.ResultOfFreshAir == null)
				{
					return 0.0;
				}
				return this.ResultOfFreshAir.HeatingLoad;
			}
		}

		public double HeatingVentilationSensibleLoad
		{
			get
			{
				if (this.ResultOfFreshAir == null)
				{
					return 0.0;
				}
				return this.ResultOfFreshAir.HeatingSensibleLoad;
			}
		}

		public double HeatingVentilationLatentLoad
		{
			get
			{
				if (this.ResultOfFreshAir == null)
				{
					return 0.0;
				}
				return this.ResultOfFreshAir.HeatingLatentLoad;
			}
		}

		public double HeatingVentilationHumidityLoad
		{
			get
			{
				if (this.ResultOfFreshAir == null)
				{
					return 0.0;
				}
				return this.ResultOfFreshAir.HeatingHumidityLoad;
			}
		}

		public double HeatingTotalLoadDensity
		{
			get
			{
				return base.HeatingLoad / this.m_room.RoomArea;
			}
		}

		public double HeatingHumidityLoadDensity
		{
			get
			{
				return base.HeatingHumidityLoad / this.m_room.RoomArea;
			}
		}

		public double HeatingHumidityDealLatentLoad
		{
			get
			{
				if (this.ResultOfXFDealLoad == null)
				{
					return 0.0;
				}
				return this.ResultOfXFDealLoad.HeatingLatentLoad;
			}
		}

		public double HeatingHumidityDealSensibleLoad
		{
			get
			{
				if (this.ResultOfXFDealLoad == null)
				{
					return 0.0;
				}
				return this.ResultOfXFDealLoad.HeatingSensibleLoad;
			}
		}

		public double HeatingHumidityDealHumidityLoad
		{
			get
			{
				if (this.ResultOfXFDealLoad == null)
				{
					return 0.0;
				}
				return this.ResultOfXFDealLoad.HeatingHumidityLoad;
			}
		}

		public double IndoorHeatingAirConditioningLoadDentisy
		{
			get
			{
				return this.AirConditioningHeatingResult.HeatingLoad / this.m_room.RoomArea;
			}
		}

		public double HeatingAirConditioningLoadDensity
		{
			get
			{
				return this.AirConditioningHeatingResult.HeatingLoad / this.m_room.RoomArea;
			}
		}

		public double DesignHeatT
		{
			get
			{
				return this.Room.RoomParam.DjSnSjWd;
			}
		}

		public double HeatingRelativeHumidity
		{
			get
			{
				return this.Room.RoomParam.DjSNSjXdSd;
			}
		}

		public double BasicHeatingLoadofSurfaces
		{
			get
			{
				if (this.m_stuDJHeatDetail == null)
				{
					return 0.0;
				}
				return this.m_stuDJHeatDetail.BaseHeatLoad;
			}
		}

		public double AdditionalHeatingLoadofSurfaces
		{
			get
			{
				if (this.m_stuDJHeatDetail == null)
				{
					return 0.0;
				}
				return this.m_stuDJHeatDetail.AdditionHeatLoad;
			}
		}

		public double GapInfiltrationHeatingLoad
		{
			get
			{
				if (this.m_stuDJHeatDetail == null)
				{
					return 0.0;
				}
				return this.m_stuDJHeatDetail.GapFilterAirLoad;
			}
		}

		public double AirInfiltrationHeatingLoad
		{
			get
			{
				if (this.m_stuDJHeatDetail == null)
				{
					return 0.0;
				}
				return this.m_stuDJHeatDetail.AirFilterLoad;
			}
		}

		public double HeatingLoadbyOpeningtheoutdoor
		{
			get
			{
				if (this.m_stuDJHeatDetail == null)
				{
					return 0.0;
				}
				return this.m_stuDJHeatDetail.DoorOpenHeatLoad;
			}
		}

		public double HeatingRadiatorTransferLoad
		{
			get
			{
				if (this.m_stuDJHeatDetail == null)
				{
					return 0.0;
				}
				return this.m_stuDJHeatDetail.InterRoomHeatLoad;
			}
		}

		public double HeatingRadiatorLoad
		{
			get
			{
				if (this.m_stuDJCnLoad == null)
				{
					return 0.0;
				}
				return this.m_stuDJCnLoad.HeatingLoad;
			}
		}

		public double HeatingRadiatorbutTransferLoad
		{
			get
			{
				if (this.m_stuDJCnLoad == null)
				{
					return 0.0;
				}
				return this.m_stuDJCnLoad.HeatingLoadButTransfer;
			}
		}

		public double HeatingRadiatorLoadDensity
		{
			get
			{
				return this.HeatingRadiatorLoad / this.m_room.RoomArea;
			}
		}

		public double HeatingRadiatorbutTransferLoadDensity
		{
			get
			{
				return this.HeatingRadiatorbutTransferLoad / this.m_room.RoomArea;
			}
		}

		private Dictionary<HcObjectType, RoomLoadResult> m_dicResults;

		private Result m_ResultOfExteriorSurfaces;

		private Result m_ResultOfInteriorSurfaces;

		private Result m_ResultOfSurfaces;

		private Result m_ResultOfXFDealLoad;

		private Result m_ResultOfInDoorLoad;

		private double m_dXFVolum;

		private double m_dDJXFVolum;

		private Room m_room;

		private bool bGetLoadItems;

		private double[] aryCoolingLoadofWall;

		private double[] aryCoolingLoadDensity;

		private double[] aryHumidityLoadDensity;

		private double[] aryIndoorCoolingLoadDensity;

		private double[] aryIndoorHumidityLoadDensity;

		private HeatingResult m_stuDJCnLoad;

		private ConsumedHeatingResult m_stuDJHeatDetail;

		private AirConditioningHeatingResult m_stuDJKtLoad;
	}
}
